package com.Inter.D01;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class A01 {
    public static void main(String[] args) throws UnknownHostException {
        // 获取inetAddress 192.168.1.100
        // ip的对象 - 电脑的对象
        InetAddress addtess = InetAddress.getByName("DESKTOP-PQGBRST");
        // DESKTOP-PQGBRST
        System.out.println(addtess);
        // 获取名称
        String hostName = addtess.getHostName();
        System.out.println(hostName);
        // 获取地址
        String ip = addtess.getHostAddress();
        System.out.println(ip);
    }
}
